/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ComponenteEntidad;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Marilyn
 */
@Entity
@Table(name = "empresa")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Empresa.findAll", query = "SELECT e FROM Empresa e"),
    @NamedQuery(name = "Empresa.findByIdEmpresa", query = "SELECT e FROM Empresa e WHERE e.idEmpresa = :idEmpresa"),
    @NamedQuery(name = "Empresa.findByEmpRUC", query = "SELECT e FROM Empresa e WHERE e.empRUC = :empRUC"),
    @NamedQuery(name = "Empresa.findByEmpRazSoc", query = "SELECT e FROM Empresa e WHERE e.empRazSoc = :empRazSoc"),
    @NamedQuery(name = "Empresa.findByEmpDuenio", query = "SELECT e FROM Empresa e WHERE e.empDuenio = :empDuenio")})
public class Empresa implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idEmpresa")
    private Integer idEmpresa;
    @Basic(optional = false)
    @NotNull
    @Size(min = 0, max = 15)
    @Column(name = "emp_RUC")
    private String empRUC;
    @Basic(optional = false)
    @NotNull
    @Size(min = 0, max = 150)
    @Column(name = "emp_RazSoc")
    private String empRazSoc;
    @Basic(optional = false)
    @NotNull
    @Size(min = 0, max = 200)
    @Column(name = "emp_Duenio")
    private String empDuenio;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "empresa", fetch = FetchType.LAZY)
    private List<Agencia> agenciaList;

    public Empresa() {
    }

    public Empresa(Integer idEmpresa) {
        this.idEmpresa = idEmpresa;
    }

    public Empresa(Integer idEmpresa, String empRUC, String empRazSoc, String empDuenio) {
        this.idEmpresa = idEmpresa;
        this.empRUC = empRUC;
        this.empRazSoc = empRazSoc;
        this.empDuenio = empDuenio;
    }

    public Integer getIdEmpresa() {
        return idEmpresa;
    }

    public void setIdEmpresa(Integer idEmpresa) {
        this.idEmpresa = idEmpresa;
    }

    public String getEmpRUC() {
        return empRUC;
    }

    public void setEmpRUC(String empRUC) {
        this.empRUC = empRUC;
    }

    public String getEmpRazSoc() {
        return empRazSoc;
    }

    public void setEmpRazSoc(String empRazSoc) {
        this.empRazSoc = empRazSoc;
    }

    public String getEmpDuenio() {
        return empDuenio;
    }

    public void setEmpDuenio(String empDuenio) {
        this.empDuenio = empDuenio;
    }

    @XmlTransient
    public List<Agencia> getAgenciaList() {
        return agenciaList;
    }

    public void setAgenciaList(List<Agencia> agenciaList) {
        this.agenciaList = agenciaList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idEmpresa != null ? idEmpresa.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Empresa)) {
            return false;
        }
        Empresa other = (Empresa) object;
        if ((this.idEmpresa == null && other.idEmpresa != null) || (this.idEmpresa != null && !this.idEmpresa.equals(other.idEmpresa))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "ComponenteEntidad.Empresa[ idEmpresa=" + idEmpresa + " ]";
    }
    
}
